<!-- reportingResults -->
<template>
    <div class="page" v-if="showShare == 0">
        <div class="t"></div>
        <div class="pageHeader">
            <div>保单检视</div>
        </div>
        <div class="pageSec">
            <div class="pageSecO">
                <img src="../../assets/jst/bt.png" alt="">
                <img src="../../assets/jst/jsbg.png" alt="">
            </div>
            <div class="pageSecT">
                <div>{{w.split('s')[0]}}
                <span>{{w.split('s')[1]}}</span>
                {{w.split('s')[2]}}</div>
            </div>
        </div>
        <div class="pageHxz"></div>
        <div class="pageHxzq">
            <div class="xzqDv">
                <span style="color: #FA8A0C;">您理解并同意：</span>
                    {{ybcwz}}<span style="color: #198AFA;" @click="jstPrivacyPolicy()">【个人信息保护政策】</span>。
            </div>
        </div>
       <div class="pageButton" @click="goReportingResulbh()" v-log-button-name="'保单检视_欢迎页_开启我的保单检视服务'"> 
            <div>同意开启我的保单检视旅程</div>
        </div>
    </div>
</template>
<script lang="ts" setup name="reportshare">
import { useRouter, useRoute } from "vue-router"
import { Toast } from '/@/utils/Message';
import { onMounted } from "vue"
import { reactive, ref } from 'vue'
import { getConfiguration } from "/@/api/auth/repot.ts";
import { jstJudgeFirst, jstJointLogin, jstStatusUpdate, jstCommonPromptText } from "/@/api/jst/h.ts"
import z  from '../../assets/jst/7.png'
import q  from '../../assets/jst/8.png'
import e  from '../../assets/jst/9.png'
import t  from '../../assets/jst/10.png'

const router = useRouter()
const route = useRoute()
const titleTest = ref("邀请客户")
let data = reactive({
   ...route.query
});
const dataLst = ref(
    [
        { src: z, value: '保单管理更加清晰' },
        { src: q, value: '及时发现潜在风险' },
        { src: e, value: '提高理赔效率和保障程度' },
        { src: t, value: '优化保险方案' }
    ]
)
const token:any = ref('')

let showShare = ref(1);
const w = ref('')
const goReportingResulbh = async () => {
  let c = await jstStatusUpdate(sessionStorage.getItem('jstJointLoginVo'));
  router.replace({ path: '/jstWorkTable'})
}
const ybcwz =  ref('');
const a = () => {
    // 语音权限
    var obj = {
        method: 'jstMicrophonePermissions',
        data: {}
    }
    if(navigator.userAgent.indexOf("JinShiTong_iOS") !== -1){
        (window as any).webkit.messageHandlers.interactive.postMessage(obj);
    } else if (navigator.userAgent.indexOf("JinShiTong_Android")!== -1){ 
        //interactive 安卓端定义的类名 postMessage 安卓端定义的方法名
        (window as any).interactive.postMessage(JSON.stringify(obj))
    }
}
const jstMicrophoneJudgment = ref('')
const jstCameraJudgment = ref('')
// 语音权限
let jstMicrophone = (q:any) =>{
    console.log('语音权限')
    console.log(q,'q语音权限')
    jstMicrophoneJudgment.value = q.jstMicrophoneJudgment
    if(jstMicrophoneJudgment.value == 'true') {
        // 人脸权限 
        var objz = {
            method: 'jstCameraPermissions',
            data: {}
        }
        if(navigator.userAgent.indexOf("JinShiTong_iOS") !== -1){
        (window as any).webkit.messageHandlers.interactive.postMessage(objz);
        } else if (navigator.userAgent.indexOf("JinShiTong_Android")!== -1){ 
            //interactive 安卓端定义的类名 postMessage 安卓端定义的方法名
            (window as any).interactive.postMessage(JSON.stringify(objz))
        }
    } else {
        // Toast(res.msg) // 暂时不给提示点击否
    }
}
// 人脸权限
let jstCamera = (q:any) =>{
    console.log('人脸权限')
    console.log(q,'q人脸权限')
    jstCameraJudgment.value = q.jstCameraJudgment
    if(jstCameraJudgment.value == 'true') {
        console.log('route')
    } else {
        // Toast(res.msg) // 暂时不给提示点击否
    }
}
// 隐私政策
const jstPrivacyPolicy = () => {
    router.push({ path: '/jstYszc'})
    // getConfiguration({ name: 'jstPrivacyPolicy' }).then((v: any) => {
    //     window.location.href = v.data
    // })
}
// 获取高度
let getStatusBarHeight = () => {
    const ua = navigator.userAgent
    const andoridUAIndex = ua.indexOf('JinShiTong_Android')
    if(andoridUAIndex !== -1 && ua.split('JinShiTong_Android').length == 2){
        const height = ua.split('JinShiTong_Android')[1]
        // console.log(`${+height /2}px`,'安卓导航栏高度')
        console.log(ua.split('JinShiTong_Android'))
        return`${+height /2}px`
    }
    const iosUAIndex = ua.indexOf('JinShiTong_iOS')
    if(iosUAIndex !==-1 && ua.split('JinShiTong_iOS').length == 2){
        const height = ua.split('JinShiTong_iOS')[1]
        return `${+height}px`
    }
    console.log(`20px`,'导航栏高度')
    return '20px'
}
onMounted(async()=>{
    sessionStorage.setItem('jstHeaderHeight',JSON.stringify(getStatusBarHeight()))
    // return
    // (window as any ).jstMicrophone = jstMicrophone,
    // (window as any ).jstCamera = jstCamera
    if(data.token) {
        token.value = data.token
        sessionStorage.setItem('jstToken',JSON.stringify(token.value))
    }
    let z = await jstCommonPromptText(2);
    ybcwz.value = z.data
    let b = await jstCommonPromptText(1);
    w.value = b.data

    let c = await jstJointLogin({token:token.value});
    if(c.code == 200){
        sessionStorage.setItem('jstJointLoginVo',JSON.stringify(c.jstJointLoginVo))
        sessionStorage.setItem('customToken', c.customToken)
        let d = await jstJudgeFirst(c.jstJointLoginVo);
        if(d.code == 200) {
            console.log(d.customToken)
            showShare.value = d.data
            if(showShare.value == 1) {
                router.replace({ path: '/jstWorkTable'})
            }
        }
    } else {
        // token失效 
        var objz = {
            method: 'reLogin',
            data: {
                code:'900',
                msg: c.msg || '联合登录失效请重新登录'
            }
        }
        if(navigator.userAgent.indexOf("JinShiTong_iOS") !== -1){
            (window as any).webkit.messageHandlers.interactive.postMessage(objz);
        } else if (navigator.userAgent.indexOf("JinShiTong_Android")!== -1){ 
            //interactive 安卓端定义的类名 postMessage 安卓端定义的方法名
            (window as any).interactive.postMessage(JSON.stringify(objz))
        }
    }
})
</script>

<!-- less嵌套设置 -->
<style lang="less" scoped>
.t {
    top: 0;
    z-index: 1;
    width: 100%;
    height: 230px;
    position: absolute;
    background: url('../../assets/jst/bj.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
}
.page {
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
    // background: linear-gradient( 0, rgba(255,255,255,0) 70%, #2792FC 100%, #0280FF 100%);
    background: linear-gradient( 181deg, #BDE1FF 0%, #B7D8FE 10%, #B8DAFC 50%, #BCD8FD 100%);
    .pageHxz {
        z-index: 10;
        width: 97%;
        height: 117px;
        margin-top: 10px;
        margin-left: 1.5%;
        position: relative;
        background: url('../../assets/jst/mk.png');
        background-size: 100% 100%;
        background-repeat: no-repeat;
    }
    .pageHxzq {
        width: 93%;
        z-index: 10;
        display: flex;
        // height: 300px;
        padding-bottom: 17px;
        margin-top: 10px;
        margin-left: 3.5%;
        position: relative;
        justify-content: center;
        background: url('../../assets/jst/btj.png');
        background-size: 100% 100%;
        background-repeat: no-repeat;
        .xzqDv {
            width: 93%;
            // height: 230px;
            padding: 10px;
            font-size: 14px;
            margin-top: 47px;
            text-align: left;
            border-radius: 13px;
            box-shadow: 0px 0px 20px 0px rgba(226,226,226,0.2);
            background: linear-gradient( 48deg, #F5FCFF 0%, #FFFFFF 59%, #F5FCFF 100%);
        }
    }
    .pageSec {
        width: 93%;
        z-index: 10;
        min-height: 170px;
        margin-top: 27px;
        margin-left: 3.5%;
        position: relative;
        padding: 10px 13px;
        border-radius: 13px;
        background: linear-gradient( 180deg, #B8DBFF 0%, #DEEDFD 4%, #FFFFFF 10%, #FFFFFF 61%, #F8FBFF 96%, #DEEDFD 100%);
        .pageSecO {
            width: 100%;
            display: flex;
            justify-content: space-between;
            img:nth-child(1){
                width: 207px;
                height: 54px; 
            }
            img:nth-child(2){
                width: 73px;
                height: 70px; 
            }
        }
        .pageSecT {
            width: 100%;
            font-size: 14px;
            margin-top: 10px;
            text-align: left;
            span {
                // color: #FA8A0C;
                color: #000;
                font-size: 17px;
                font-weight: bold;
            }
        }
    }
    .pageButton {
        width: 100%;
        // bottom: 30px;
        margin-top: 45px;
        margin-bottom: 30px;
        display: flex;
        // position: fixed;
        justify-content: center;
        div {
            width: 70%;
            color: #fff;
            padding: 7px 10px;
            border-radius: 17px;
            background: linear-gradient(0 , #44A1FD 0%, #2792FC 48%, #298BF0 100%); 
        }
    }
    .pageHeader {
        z-index: 10;
        width: 97%;
        display: flex;
        font-size: 17px;
        margin-top: 70px;
        color: #FFFFFF;
        padding-left: 10px;
        position: relative;
        justify-content: center;
    }
}
</style>

